﻿@model IEnumerable<Common.Type.TreeViewNode>
<ul class="nav child_menu">
    @foreach (var item in Model)
    {
        <li>
            @if (item.ActiveStatus.Equals("C"))
            {
                <a>@item.Value<span class="label label-danger pull-right">Coming Soon</span></a>
            }
            else if (item.ActiveStatus.Equals("D"))
            {
                if (item.Controller.Equals("SalePerformance"))
                {
                    <a href="@Url.Action(item.Action, item.Controller, new { dao = Request.QueryString["dao"] })">@item.Value<span class="label label-primary pull-right">Demo</span></a>}
                else
                {
                    <a href="@item.Url">@item.Value<span class="label label-primary pull-right">Demo</span></a>
                }
            }
            else if (item.ActiveStatus.Equals("TBC"))
            {
                if (item.Controller.Equals("SalePerformance"))
                {
                    <a href="@Url.Action(item.Action, item.Controller, new { dao = Request.QueryString["dao"] })">@item.Value<span class="label label-primary pull-right">to be continued</span></a>}
                else
                {
                    <a href="@item.Url">@item.Value<span class="label label-primary pull-right">to be continued</span></a>
                }
            }
            else if (item.ActiveStatus.Equals("New"))
            {
                if (item.Controller.Equals("SalePerformance"))
                {
                    <a href="@Url.Action(item.Action, item.Controller, new { dao = Request.QueryString["dao"] })">@item.Value<span class="label label-danger pull-right">New</span></a>}
                else
                {
                    <a href="@item.Url">@item.Value<span class="label label-danger pull-right">New</span></a>
                }
            }
            else if ((item.Nodes != null && item.Nodes.Count > 0) || string.IsNullOrEmpty(item.Url))
            {
                <a class="dropmenu">
                    @if (!string.IsNullOrEmpty(item.CssIcon))
                    {<i class="@item.CssIcon"></i>}@item.Value<span class="fa fa-chevron-down"></span>
                </a>
                <ul class="nav child_menu">
                    @foreach (var subItem in item.Nodes)
                    {
                        if (subItem.ActiveStatus.Equals("C"))
                        {
                            <li class="sub_menu">
                                <a>@subItem.Value<span class="label label-danger pull-right">Coming Soon</span></a>
                            </li>
                        }
                        else if (subItem.ActiveStatus.Equals("D"))
                        {
                            <li class="sub_menu">
                                @if (subItem.Controller.Equals("SalePerformance"))
                                {
                                    <a href="@Url.Action(subItem.Action, subItem.Controller, new { dao = Request.QueryString["dao"] })">@item.Value<span class="label label-primary pull-right">Demo</span></a>}
                                else
                                {
                                    <a href="@subItem.Url">@subItem.Value<span class="label label-primary pull-right">Demo</span></a>
                                }
                            </li>
                        }
                        else if (subItem.ActiveStatus.Equals("TBC"))
                        {
                            <li class="sub_menu">
                                @if (subItem.Controller.Equals("SalePerformance"))
                                {
                                    <a href="@Url.Action(subItem.Action, subItem.Controller, new { dao = Request.QueryString["dao"] })">@item.Value<span class="label label-primary pull-right">To be continued</span></a>}
                                else
                                {
                                    <a href="@subItem.Url">@subItem.Value<span class="label label-primary pull-right">To be continued</span></a>
                                }
                            </li>
                        }
                        else
                        {
                            <li class="sub_menu">
                                @if (subItem.Controller.Equals("SalePerformance"))
                                {
                                    @Html.ActionLink(subItem.Value, subItem.Action, subItem.Controller, new { dao = Request.QueryString["dao"] }, null)
                                }
                                else
                                {
                                    @Html.ActionLink(subItem.Value, subItem.Action, subItem.Controller, null, null)
                                }
                            </li>
                        }


                    }

                </ul>
            }
            else
            {
                if (item.Controller.Equals("SalePerformance"))
                {

                    <a class="submenu" href="@Url.Action(item.Action, item.Controller, new { dao = Request.QueryString["dao"] })">
                        @if (!string.IsNullOrEmpty(item.CssIcon))
                        {<i class="@item.CssIcon"></i>}<span class="@item.CssIcon">@item.Value</span>
                    </a>
                }
                else
                {
                    <a class="submenu" href="@item.Url">
                        @if (!string.IsNullOrEmpty(item.CssIcon))
                        {<i class="@item.CssIcon"></i>}<span class="@item.CssIcon">@item.Value</span>
                    </a>
                }

            }
            @*<a>@item.Value<span class="fa fa-chevron-down"></span></a>*@
            @*@Html.ActionLink(item.Value, item.Action, item.Controller, null, null)*@
        </li>
    }
</ul>